package rank1300;

import java.util.Collections;
import java.util.List;

/**
 * 2895. 最小处理时间
 */
public class No2895 {
    public int minProcessingTime(List<Integer> processorTime, List<Integer> tasks) {
        Collections.sort(processorTime);
        Collections.sort(tasks);
        int ans = 0;
        for (int i = 0; i < processorTime.size(); i++) {
            ans = Math.max(ans, tasks.get(tasks.size() - 1 - i * 4) + processorTime.get(i));
        }
        return ans;
    }
}
